package com.blb.springboot.config;

import com.blb.springboot.interceptor.DropBoxInterceptor;
import com.blb.springboot.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author lvtian
 * @date 2023/1/10 19:44
 */
@Configuration
public class DropBoxConfig implements WebMvcConfigurer {
    @Bean
    public DropBoxInterceptor getDropBoxInterceptor() {
        return new DropBoxInterceptor();
    }

    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //在拦截器注册中添加自定义拦截器
        registry.addInterceptor(getDropBoxInterceptor())
                //配置拦截路径 /**代表所有路径
                .addPathPatterns("/**");
                //排除路径
//                .excludePathPatterns("/**/world","/**/*.js","/**/*.css");

    }
}
